for _ in range(int(input())):
n=int(input())
if n==1:
print(1)
print(1,2)
else:
a, b = 1, 3 * n
n=(n+1)//2
print(n)
for i in range(n):
print(a,b)
a+=3
b-=3
'''
BAN BAN BAN BAN
BNNN
'''
'''
123456789101112
BANBANBANBAN
'''
#include <bits/stdc++.h>
using namespace std;
/* clang-format off */
//! TYPES
#define ll long long
// pair
#define pii pair<int, int>
#define pll pair<long long, long long>
//vector
typedef vector<int>::iterator vit;
#define vi vector<int>
#define vll vector<long long>
typedef vector<char> vc;
typedef vector<string> vs;
// map
#define mii map<int, int>
//set
typedef set<int>::iterator sit;
#define si set<int>
#define sc set<char>
/* FUNCTIONS */
#define f(i, s, e) for(long long int i=s;i<e;i++)
#define cf(i, s, e) for(long long int i=s;i<=e;i++)
#define rf(i, e, s) for(long long int i=e-1;i>=s;i--)
#define pb push_back
#define eb emplace_back
#define ff first
#define s second
#define all(n) (n).begin(), (n).end()
//! PRINTS
#define sp <<" "<<
#define ss <<
#define e << endl
#define endl '\n'
//print vector
template<typename T>
void print_v(vector<T> &v) {
cout << "{";
for (auto x: v) cout << x << ",";
cout << "\b}";
};
//print set
template<typename T>
void print_s(set<T> &v) {
cout << "{";
for (auto x: v) cout << x << ",";
cout << "\b}";
};
//print array
template<typename T>
void print(const T array[], size_t SIZE) { for (size_t i = 0; i < SIZE; i++) std::cout << array[i] << " "; }
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define read(type) readInt<type>()
ll min(ll a, int b) {
if (a < b) return a;
return b;
}
ll min(int a, ll b) {
if (a < b) return a;
return b;
}
ll max(ll a, int b) {
if (a > b) return a;
return b;
}
ll max(int a, ll b) {
if (a > b) return a;
return b;
}
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll lcmm(ll a, ll b) { return a / gcd(a, b) * b; }
string to_upper(string a) {
for (int i = 0; i < (int) a.size(); ++i) if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A';
return a;
}
string to_lower(string a) {
for (int i = 0; i < (int) a.size(); ++i) if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 'a' - 'A';
return a;
}
bool prime(ll a) {
if (a == 1) return 0;
for (int i = 2; i <= round(sqrt(a)); ++i) if (a % i == 0) return 0;
return 1;
}
void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }
/* All Required define Pre-Processors and typedef Constants */
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
// ! USACO FILE
void u_file(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
/* clang-format on */
void gen(ll max, vll &arr) {
ll start = 1;
while (start <= 1e9) {
arr.pb(start * start);
start++;
}
}
/* Main() function */
int main() {
// u_file("");
IOS;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
if (n == 1) {
cout << n e;
cout << 1 sp 2 e;
continue;
}
if (n % 2 == 0) {
ll end = n * 3;
ll start = 1;
n /= 2;
cout << n e;
f(i, 0, n) {
cout << start sp end e;
start += 3;
end -= 3;
}
} else {
ll end = n * 3;
ll start = 1;
n /= 2;
n++;
cout << n e;
f(i, 0, n) {
cout << start sp end e;
start += 3;
end -= 3;
}
}
}
return 0;
}
510B - Fox And Two Dots | 616D - Longest k-Good Segment |
1604A - Era | 555B - Case of Fugitive |
551A - GukiZ and Contest | 1399F - Yet Another Segments Subset |
1371C - A Cookie for You | 430B - Balls Game |
1263A - Sweet Problem | 1332B - Composite Coloring |
254A - Cards with Numbers | 215A - Bicycle Chain |
1288B - Yet Another Meme Problem | 1201C - Maximum Median |
435A - Queue on Bus Stop | 1409B - Minimum Product |
723B - Text Document Analysis | 1471C - Strange Birthday Party |
1199A - City Day | 1334A - Level Statistics |
67B - Restoration of the Permutation | 1734A - Select Three Sticks |
1734B - Bright Nice Brilliant | 357B - Flag Day |
937A - Olympiad | 1075A - The King's Race |
1734C - Removing Smallest Multiples | 1004C - Sonya and Robots |
922A - Cloning Toys | 817A - Treasure Hunt |